package com.example.game

data class Card(
    val id: Int,           // 卡片唯一ID
    val imageResId: Int,   // 正面图片资源ID
    var isFlipped: Boolean = false,  // 是否已翻转
    var isMatched: Boolean = false   // 是否已匹配
) {
    // 翻转卡片
    fun flip() {
        if (!isMatched) {
            isFlipped = !isFlipped
        }
    }

    // 设置为已匹配状态
    fun setMatched() {
        isMatched = true
        isFlipped = true
    }

    // 重置卡片状态
    fun reset() {
        isFlipped = false
        isMatched = false
    }
}


